<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/common/tags.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<template:header context="${context}" title="Group - ${group.id} - Administration - Redmine"/>
<script type="text/javascript">
	$(document).ready(function() {
		$('#logincheck').click(function() {
			$.getJSON('/mvn-web/sample-ajax/checkloginid/' + $('#loginid').val(), function(result) {
				if (result.duplicated == true) {
					alert('이미 등록된 ID입니다. ' + result.availableId + '는 사용할 수 있습니다.')
				}
				else {
					alert('사용할 수 있는 ID입니다.');
				}
			});
		});
		
		$('#groupusers').submit(function() {
			var user = $(this).serializeObject();
			$.postJSON('/mvn-web/sample-ajax/register', user, function(user) {
				alert('사용자 생성이 완료되었습니다. id: ' + user.loginid);
			});
			
			return false;
		});
	});	
</script>
</head>
<body>
	<form id="groupusers" action="user" method="post">
		<fieldset>
			<label>로그인 아이디: </label><input id="loginid" name="loginid" type="text" value="123"/>
			<input id="logincheck" type="button" value="아이디 중복검사" /><br/>
			<label>비밀번호 : </label><input id="password" name="password" type="password" value="456"/><br/>
			<label>이름 : </label><input id="name" name="name" type="text" value="sejoon"/><br/>
			<input type="submit" value="등록"/>
		</fieldset>
	</form>
</body>
</html>